<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('数据集市列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-table table-striped">
            <table class="table table-bordered">
                <colgroup>
                    <col width="10%">
                    <col width="35%">
                    <col width="35%">
                    <col width="20%">
                </colgroup>
                <thead>
                <tr>
                    <th></th>
                    <th>目标表</th>
                    <th>名称</th>
                    <th>系统</th>
                </tr>
                </thead>
                <tbody id="fildLIst" >
                <tr th:each="item:${list}">
                    <td><input type="checkbox"></td>
                    <td th:text="${item.cdTbTar}"></td>
                    <td th:text="${item.na}"></td>
                    <td th:text="${item.sdSys}"></td>
                    <td th:text="${item.idDrawBase}" style="display: none"></td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "etl/job/drawbase";
    var jobId = "[[${jobId}]]";
    function submitHandler() {

        var checkData = $("#fildLIst").find("input:checked");
        if(checkData.length<1) {
            $.modal.alertError("至少需要选择一条数据");
            return ;
        }
        var data=[],tds;
        $.each(checkData,function (index,item) {
            tds = $(this).parent().siblings();
            data.push({"idDrawBase":tds[3].innerHTML,"idJob":jobId});
        });
        $.ajax({
            url: prefix+"/add",
            cache: false,
            type: 'POST',
            dataType: 'json',
            data: JSON.stringify(data),
            contentType: 'application/json;charset=UTF-8',
            success: function (result) {
                if(result.code=="0") {
                    $.modal.close();
                }
            }
        });
    }
</script>
</body>
</html>